

rederList=[];

/**
 * 画布分为100X60个10X10的小格子
 */
window.onload=function(){
    var mainCav=$('#maz');
    var mainCtx=mainCav.getContext('2d');

    mainCtx.drawImage(backRec.canvas,0,0);
   

    // $('#main').appendChild(backRec.canvas)

    var roomList=[];



    for(var i=0;i<250;i++){
        var temp=creRoom('#cdfe96');
        
        if(temp!=''){
            // console.log(temp)
            // console.log(i)
            roomList.push(temp);
            mainCtx.drawImage(temp.canvas,0,0);
           
        }
    }

    for(var i=0;i<roomList.length;i++){
        mainCtx.drawImage(roomList[i].canvas,0,0);
    }

    console.log('房间数量为'+roomList.length);
    console.log(roomList)
   

    
    console.log(getSqu(100,80))

    //以下是手动生成房间的代码
    // var roomList=[createRoom(2,2,30,30),createRoom(2,40,35,35),createRoom(52,2,40,40),createRoom(52,44,30,30),createRoom(100,2,45,45),createRoom(100,50,20,20)];
 
    for(var i=0;i<roomList.length;i++){
        (function(i){
            setTimeout(function() {
                 mainCtx.drawImage(roomList[i].canvas,0,0);
            }, 20);
        })(i);
       
    }
    
    
    //----------------------------------------------------------

    //一下是第一种走道的生成代码
    var testCor=createCor('#efefef');
    console.log(testCor)
    mainCtx.drawImage(testCor.canvas,0,0)
    //----------------------------------------------------

    //一下将canvas生成图片并保存
    //  var image = mainCav.toDataURL("image/png").replace("image/png", "image/octet-stream");   
    // window.location.href=image; // it will save locally  
   
    
}